# -*- coding: utf-8 -*-
from student import *
course_list = []
stu_list = []

class Course:
    def __init__(self,name,period,teacher):
        self.name = name
        self.period = period
        self.teacher = teacher
        
    def show(self):
        print('课程名：{}上课时间：{}代课老师{}'.format(self.name,self.period,self.teacher))
        


class Admin:
    def __init__(self,account,pwd):
        self.account = account
        self.pwd = pwd
        
        
    def create_class(self):
        print('-----创建课程------')
        name = input('请输入课程名称：')
        period = input('请输入上课期间：')
        teacher = input('请输入老师：')
        course = Course(name, period, teacher)
        course_list.append(course)
    
    def create_stu_ac(self):
        print('-----创建学生账号---------')
        account = input('请输入账号：')
        pwd = input('请输入密码：')
        name = input('输入学生姓名：')
        with open('stu_ac.txt','a',encoding='utf-8') as f:
            msg = '{}|{}|{}\n'.format(account,pwd,name)
            f.write(msg)
            
    def check_class(self):
        print('-------查看所有课程--------')
        for course in course_list:
            course.show()
    
    def check_stu(self):
        print('--------查看所有学生--------')
        with open('stu_ac.txt','r',encoding='utf-8') as f:
            student_list = f.readlines()
        for item in student_list:
            info = item.split('|')
            print('姓名：{},账号：{},密码：{}'.format(info[2],info[0],info[1]))
    
    def check_stu_choose(self):
        for student in stu_list:
            student.show()
            
    def exit_(self):
        exit()
    